package demo1;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: ASUS
 * Date: 2023-10-16
 * Time: 17:43
 */
public class Test3 {
    public static void swap(int[] array){
        int  tmp = array[0];
        array[0] = array[1];
        array[1] = tmp;
    }
    public static void main(String[] args) {
        int[] array = {1, 2};
        System.out.println("交换前："+array[0] + " " + array[1]);
        swap(array);
        System.out.println("交换后："+array[0] + " " + array[1]);
    }
}
